﻿using HelenServer.UserCenter.Contracts;

namespace HelenServer.UserCenter.Controllers;

[ApiController]
[Route("[controller]")]
public class LoginController : ControllerBase
{
    private readonly IAuthenticationService _service;

    public LoginController(IAuthenticationService service)
    {
        _service = service;
    }

    [HttpPost]
    public async Task<OperationResult<string>> LoginAsync([FromBody] LoginModel model)
    {
        var operation = HttpContext.GetOperation(model);

        return await _service.LoginAsync(operation, HttpContext.RequestAborted);
    }
}